package com.eascs.afterloan.service;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.eascs.admin.common.vo.ModelResult;
import com.eascs.admin.loan.servise.IO2oLoanBatchRunService;
import com.eascs.admin.o2o.loan.entity.O2oLoanapplyEntity;
import com.eascs.admin.o2o.loan.service.O2oLoanapplyService;
import com.eascs.app.log.Logger;
import com.eascs.app.log.LoggerFactory;

@Service
public class O2oLoanBatchRunService implements IO2oLoanBatchRunService {
	private static Logger logger = LoggerFactory.getLogger(O2oLoanBatchRunService.class);
	@Autowired
	private DeclareSignService declareSignService;
	@Autowired
	private O2oLoanapplyService o2oLoanapplyService;

	@Override
	public ModelResult<Boolean> loanBankBC(String loanapplyNo) {
		ModelResult<Boolean> modelResult = new ModelResult<Boolean>();
		try {
			logger.info("param loanapplyNo:[{}]", loanapplyNo);
			O2oLoanapplyEntity loanEntity = o2oLoanapplyService.findById(loanapplyNo);
			logger.info("find result:【{}】", loanEntity);
			declareSignService.timer(loanEntity, "BC");
			modelResult.withModel(true);
		} catch (Exception e) {
			logger.error("BC bank loan error msg:【{}】", e.getMessage());
			modelResult.withError("BCBankLoanError", "中行放款插入跑批表错误");
		}
		return modelResult;
	}

}
